﻿$(document).ready(function(){
    $("#LoginButton").click(OnSubmitLogin);
    $("#LogoutButton").click(Logout);
    CheckIfLoggedIn();
});

function OnSubmitLogin(event){
    LogosoftSharepoint.WebServices.LoginService.Login(document.getElementById("LoginInput").value, 
                        document.getElementById("PassInput").value,
                        LoginCallback);
    event.preventDefault();
}

function LoginCallback(loginResult) {
    loginResult = StripWebServiceResponse(loginResult);
    if(loginResult == true){
        window.location = "../TasksList.aspx";
    }else{
        alert("Podane hasło jest nieprawidłowe!");
    }
}

